
import { registerClass } from "../../../cfw/tools/class_decorator";
import { ResultState } from "../../SDKDefine";
import BaseAd from "../../core/base/BaseAd";

@registerClass('ViGooRewardAd')
export default class ViGooRewardAd extends BaseAd {
    hide(): void {
    }
    load(): void {
        if (this.ad) {
            this.ad.load();
        }
    }


    open() {
        this.show();
    }

    create() {

    }
    destroy(): void {

    }
    show() {
        console.log(' ViGoo show ')
        this.sdk.ShowExcitationVideoAdv((ret: any) => {
            // ret.type = ‘1’表示播放失败
            console.log(' ViGoo show ret ', ret)
            console.log(' ViGoo show ret.type ', ret.type)
            const type = ret.type;
            switch (type) {
                case '1':
                    console.log('广告异常')
                    this.callResultCallback(ResultState.NO)
                    break;
                case '2':
                    console.log('播放跳过')
                    this.callResultCallback(ResultState.NO)
                    break;
                case '3':
                    console.log('播放结束')
                    this.callResultCallback(ResultState.YES)
                    break;
                default:
                    this.callResultCallback(ResultState.NO)
                    break;
            }
        });
    }
}